package org.example.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.web.multipart.MultipartFile;

import java.io.Serializable;

@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString
public class Product implements Serializable {
    private static final long serialVersionUID = 1L; //完成序列化操作
    @TableId(type = IdType.AUTO,value = "product_id")
    private Integer product_id; //商品ID
    @TableField(value = "category_id")
    private Integer category_id; //分类ID
    @TableField(value = "product_name")
    private String product_name; //商品名称
    @TableField(value = "main_url")
    private String main_url; //主图URL
    @TableField(value = "sub_url")
    private String sub_url; //子图URL(多个图片用逗号分隔)
    @TableField(value = "description")
    private String description; //商品描述
    @TableField(value = "price")
    private Double price; //当前价格
    @TableField(value = "original_price")
    private Double original_price; //原价
    @TableField(value = "product_status")
    private Integer product_status; //状态(0-下架 1-上架)

    @TableField(exist = false)
    @JsonIgnore //json生成时忽略这个属性
    private MultipartFile mainImgFile;  //上传到oss的真是图片文件

    @TableField(exist = false)
    private MultipartFile[] subImgFile;  //上传到oss的真是图片文件

    @TableField(exist = false)
    private String category_name;
}
